<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        body,html{
            width: 100%;
            height: 100%;
        }
        body{
            background: url(img/reg_bg_min.jpg) no-repeat center;
            background-size: cover;
        }
        .box{
            width: 600px;
            height: 400px;
            background: #ffffff;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
        }
        .username,.password,.check,.detection{
            width: 600px;
            padding-left: 30px;
            box-sizing: border-box;
            line-height: 50px;
        }
        #username,#password{
            width: 300px;
            height: 30px;
            border-radius: 10px;
            padding-left: 20px;
        }
        .username span{
            margin-right: 30px;
        }
        .password span{
            margin-right: 45px;
        }
        #check{
            margin-right: 20px;
        }
        .detection{
            text-align: center;
        }
        #detection,#login{
            display: inline-block;
            width: 150px;
            height: 50px;
            background: chartreuse;
            text-align: center;
            line-height: 50px;
            border: 1px solid black;
            color: black;
            font-size: 20px;
            text-decoration: none;
        }
        #detection{
            margin-right: 20px;
        }
    </style>
</head>
<body>
    <div class="box">
        <h2 style="text-align: center;">登陆页面</h2>
        <hr>
        <p class="username">
            <span>用户名</span>
            <input type="text" placeholder="请输入用户名" id="username">
        </p>
        <p class="password">
            <span>密码</span>
            <input type="password" placeholder="请输入密码" id="password">
        </p>
        <p class="check">
            <input type="checkbox" id="check">30天免登录
        </p>
        <p class="detection">
            <a href="#" id="detection">登录</a>
            <a href="zhuce.html" id="login">注册</a>
        </p>
    </div>
</body>
</html>
<script src="jquery.min.js"></script>
<script>
    $("#detection").click(function(){
        $.ajax({
            url:"http://10.35.170.245:1001/denglu",
            method:'get',
            data:{
                username:$("#username").val(),
                password:$("#password").val()
            },
            success(data){
                if(data === "success"){
                    $("#detection").attr('href',`student.html`)
                }
                else{
                    alert("登录失败！请检查您的用户名或密码是否输入正确")
                }
            }
        })
    })

</script>